quote the binary name in the warning
authorxftroxgpx <xftroxgpx@gmail.com>
Tue, 18 Jul 2017 09:13:34 +0000 (11:13 +0200)
committerxftroxgpx <xftroxgpx@gmail.com>
Tue, 18 Jul 2017 09:13:34 +0000 (11:13 +0200)
to avoid confusion when the warning happens inside a workspace, example:
pwd is rustlearnage/rust_books/1_first_edition/closures/
and `cargo run` shows:

warning: path `src/main.rs` was erroneously implicitly accepted for binary match,
please set bin.path in Cargo.toml

(note that 'match' is not quoted, so it's confusing)

the 'match' project that it's referring to is in rustlearnage/rust_books/1_first_edition/match/
(note: Cargo.toml [workspace] is in rustlearnage/ )

src/cargo/util/toml/targets.rs
tests/build.rs

index d7e6af08c13709ad5b05bd3af41aedff7e350aa6..9cd5ed5ffff0239d72537dc48226049b5b3b73bf 100644 (file)
@@ -182,7 +182,7 @@ fn clean_bins(toml_bins: Option<&Vec<TomlBinTarget>>,
                         .unwrap_or(&legacy_path);
 
                     warnings.push(format!(
-                        "path `{}` was erroneously implicitly accepted for binary {},\n\
+                        "path `{}` was erroneously implicitly accepted for binary `{}`,\n\
                          please set bin.path in Cargo.toml",
                         short_path.display(), bin.name()
                     ));
index 8c7b0c59bd4d0011b3718d925e57a2e08265edd0..c94f5c56be8b90a0b6d2e2a0ea5419d0973859e3 100644 (file)
@@ -1402,7 +1402,7 @@ fn legacy_binary_paths_warinigs() {
         .file("src/main.rs", "fn main() {}");
 
     assert_that(p.cargo_process("build").arg("-v"), execs().with_status(0).with_stderr_contains("\
-[WARNING] path `src[/]main.rs` was erroneously implicitly accepted for binary bar,
+[WARNING] path `src[/]main.rs` was erroneously implicitly accepted for binary `bar`,
 please set bin.path in Cargo.toml"));
 
     let mut p = project("world");
@@ -1419,7 +1419,7 @@ please set bin.path in Cargo.toml"));
         .file("src/bin/main.rs", "fn main() {}");
 
     assert_that(p.cargo_process("build").arg("-v"), execs().with_status(0).with_stderr_contains("\
-[WARNING] path `src[/]bin[/]main.rs` was erroneously implicitly accepted for binary bar,
+[WARNING] path `src[/]bin[/]main.rs` was erroneously implicitly accepted for binary `bar`,
 please set bin.path in Cargo.toml"));
 
     let mut p = project("world");
@@ -1435,7 +1435,7 @@ please set bin.path in Cargo.toml"));
         .file("src/bar.rs", "fn main() {}");
 
     assert_that(p.cargo_process("build").arg("-v"), execs().with_status(0).with_stderr_contains("\
-[WARNING] path `src[/]bar.rs` was erroneously implicitly accepted for binary bar,
+[WARNING] path `src[/]bar.rs` was erroneously implicitly accepted for binary `bar`,
 please set bin.path in Cargo.toml"));
 }